//
// Created by Administrator on 2022/11/7.
//
#ifndef SOCKETSERVER_SERVER_H
#define SOCKETSERVER_SERVER_H
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <errno.h>
#include <fcntl.h>
#include <strings.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
#include <dirent.h>
#include <sys/sendfile.h>
#include <pthread.h>

struct FdInfo{
    pthread_t pid;
    int epfd;
    int fd;
};

// 初始化用于监听的套接字
int initListenFd(int port);

int epollRun(int lfd);

void* acceptClient(void *args);

void* recvHttpRequest(void *args);

int parseRequesterLine(const char* line, int cfd);

int sendFiles(const char* fileName, int cfd);

int sendDir(const char* fileName, int cfd);

int sendHeadMsg(int cfd, int status, const char* descr, const char* type, int length);
#endif //SOCKETSERVER_SERVER_H
